//PA2-1
#include "cpu/exec/template-start.h"

#define instr cmp

static void do_execute () {
    DATA_TYPE result = op_dest->val - op_src->val;
    /* no write-back */
    update_eflags_pf_zf_sf((DATA_TYPE_S)result);
    cpu.eflags.CF = result > op_dest->val;
    cpu.eflags.OF = MSB((op_dest->val ^ op_src->val) & (op_dest->val ^ result));
    print_asm_template2();
}

/* r/m <- r : opcode 0x39/0x38 */
make_instr_helper(r2rm)

/* r <- r/m : opcode 0x3B/0x3A */
make_instr_helper(rm2r)

/* accumulator <- imm: opcode 0x3C/0x3D */
make_instr_helper(i2a)

/* r/m <- imm: opcode 0x81 /7 */
make_instr_helper(i2rm)

/* support imm8 sign-extend to rm (0x83 /7) -- only for v-size (w/l) */
#if DATA_BYTE != 1
make_instr_helper(si2rm)
#endif

#include "cpu/exec/template-end.h"


